<script>
export default {
  name: "index",
  data() {
    return {
      userList: [

      ]
    }
  },
  onLoad() {
    this.$api.getLayersList().then(res => {
      this.userList = res
    })
  },
  methods: {
    navBack() {
      this.$u.route({
        type: 'navigateBack'
      })
    },
    routeTo(item) {
      if (item) {
        this.$u.route({
          type: 'navigateTo',
          url: '/pages/LawAsk/detail?id=' + item.id
        })
      }
    }
  }
}
</script>

<template>
  <div class="LawAsk">
    <div class="custom-home-header">
      <div class="title">EasyLaw</div>
      <div class="sub-title">The elbsest ingel ald far ntemsrtlens students</div>
    </div>
    <div class="back-top"  @click="navBack">
      <u-icon name="arrow-left" size="28"></u-icon>
      <span class="back-name">LawAsk</span>
    </div>
    <div class="user-list">
      <u-row gutter="20" style="width: 100%">
        <u-col span="6" v-for="item in userList" @click="routeTo(item)">
          <div class="user-item" >
            <div class="userinfo">
              <div class="nickname">{{ item.nickname }}</div>
              <div class="year">{{ item.year}}Years</div>
            </div>
            <div class="address">{{ item.address }}</div>
            <div class="phone" @click="routeTo(item)">Know more</div>
          </div>
        </u-col>
      </u-row>

    </div>
  </div>
</template>

<style scoped lang="scss">
.LawAsk {
  .custom-home-header {
    height: 100rpx;
    background-color: #409eff;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    .title {
      font-size: 36rpx;
      line-height: 100rpx;
      padding-left: 50rpx;
    }
    .sub-title {
      font-size: 24rpx;
      color: #a6a2a2;
      margin-left: 20rpx;
      padding-top: 50rpx;
    }
  }

  .back-top {
    display: flex;
    align-items: center;
    padding: 10rpx 0;
    margin-bottom: 40rpx;
  }
  .back-name {
    margin-left: 20rpx;
    font-size: 28rpx;
    color: #333333;
  }
  .user-list {
    display: flex;
    flex-wrap: wrap;
  }
  .user-item{
    background-color: rgb(251,251,251);
    border-radius: 4px;
    padding: 20rpx 30rpx;
    margin-bottom: 20rpx;
    .userinfo {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .nickname {
        font-size: 28rpx;
        color: #333333;
      }
      .year {
        padding: 5rpx 8rpx;
        text-align: center;
        line-height: 24rpx;
        font-size: 24rpx;
        color: #FFFFFF;
        background-color: rgb(82,188,188);
        border-radius: 3px;
      }
    }
    .address {
      font-size: 26rpx;
      color: #999999;
      margin-top: 10rpx;
    }
    height: 200rpx;
    position: relative;
    .phone {
      color: #FFFFFF;
      font-size: 26rpx;
      text-align: center;
      height: 50rpx;
      background-color: rgb(147,210,243);
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
    }
  }
}
</style>
